package com.atguigu.mall.search.controller;

import com.atguigu.common.es.SkuEsModel;
import com.atguigu.common.utils.R;
import com.atguigu.mall.search.service.ProductSaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

/**
 * @author fuc
 * @create 2020-11-08
 */
@RequestMapping("/search/save")
@RestController
public class ElasticSaveController {

  @Autowired ProductSaveService productSaveService;

  /**
   * 上架商品
   *
   * @param skuEsModels
   * @return
   */
  @PostMapping("/product")
  public R productStatusUp(@RequestBody List<SkuEsModel> skuEsModels) throws IOException {
    productSaveService.productStatusUpdate(skuEsModels);
    return R.ok();
  }
}
